package com.web.exiaodao.business.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.web.exiaodao.business.entity.Banner;

public interface BannerRepository extends
		PagingAndSortingRepository<Banner, Long>,
		JpaSpecificationExecutor<Banner> {
	public Banner findByIdAndStatusNot(Long id,Integer status);
	
	public Banner findByTypeAndSortAndStatusNot(Integer type,Integer sort,Integer status);
	public List<Banner> findListByTypeAndStatusNot(Integer type,Integer status);
	
	@Query(value="SELECT * FROM `tb_xa_banner` b WHERE b.STATUS  = 1 AND (b.TYPE = 1 OR b.TYPE = 5 OR b.TYPE = 6) ORDER BY TYPE,sort DESC",nativeQuery=true)
	public List<Banner> findList();
	
	public List<Banner> findByobjectIdAndTypeAndStatusNot (Long objectId, Integer type, Integer status);
}
